<?php

namespace App\Http\Controllers\Frontend\V10\PhoneCheck;

use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;


class PhoneCheckInfoController extends Controller
{
//    public function __construct()
//    {
//        $this->middleware('auth:api');
//    }

    /**
     * Description: 根据手机号获取手机检测的注册ID和时间
     * Author: tanjun
     * DateTime: 2019-04-10 17:00
     * @return mixed
     * @param $phone_num
     */
    public function phoneCheck($phone_num=''){
        //检测时间
        $local_time=date("Y-m-d H:i:s");
        if(!$phone_num){
            return respond([
                'register_id' =>'',
                'local_time' =>$local_time ,
            ]);
        }else{
            //注册ID
            $register_id =User::where('phone_num',$phone_num)->select('phone_num_md5')->first();
            if(!$register_id){
                return respond([
                    'register_id' =>'',
                    'local_time' =>$local_time ,
                ]);
            }else{
                return respond([
                    'register_id' =>$register_id->phone_num_md5,
                    'local_time' =>$local_time ,
                ]);
                }
        }
            }
}


